package xin.clips.system.service.impl;

import java.util.List;
import java.util.UUID;

import xin.clips.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xin.clips.common.utils.ShiroUtils;
import xin.clips.system.domain.gy.GyLocation;
import xin.clips.system.mapper.gy.GyLocationMapper;
import xin.clips.common.core.text.Convert;
import xin.clips.system.service.gy.IGyLocationService;

/**
 * 网点管理Service业务层处理
 *
 * @author ruoyi
 * @date 2023-01-12
 */
@Service
public class GyLocationServiceImpl implements IGyLocationService {
    @Autowired
    private GyLocationMapper gyLocationMapper;

    /**
     * 查询网点管理
     *
     * @param locationId 网点管理主键
     * @return 网点管理
     */
    @Override
    public GyLocation selectGyLocationByLocationId(String locationId) {
        return gyLocationMapper.selectGyLocationByLocationId(locationId);
    }

    /**
     * 查询网点管理列表
     *
     * @param gyLocation 网点管理
     * @return 网点管理
     */
    @Override
    public List<GyLocation> selectGyLocationList(GyLocation gyLocation) {
        return gyLocationMapper.selectGyLocationList(gyLocation);
    }

    /**
     * 新增网点管理
     *
     * @param gyLocation 网点管理
     * @return 结果
     */
    @Override
    public int insertGyLocation(GyLocation gyLocation) {
        gyLocation.setLocationId(UUID.randomUUID().toString().replace("-", ""));
        gyLocation.setCreateTime(DateUtils.getNowDate());
        gyLocation.setCreateBy(ShiroUtils.getLoginName());
        return gyLocationMapper.insertGyLocation(gyLocation);
    }

    /**
     * 修改网点管理
     *
     * @param gyLocation 网点管理
     * @return 结果
     */
    @Override
    public int updateGyLocation(GyLocation gyLocation) {
        gyLocation.setUpdateTime(DateUtils.getNowDate());
        return gyLocationMapper.updateGyLocation(gyLocation);
    }

    /**
     * 批量删除网点管理
     *
     * @param locationIds 需要删除的网点管理主键
     * @return 结果
     */
    @Override
    public int deleteGyLocationByLocationIds(String locationIds) {
        return gyLocationMapper.deleteGyLocationByLocationIds(Convert.toStrArray(locationIds));
    }

    /**
     * 删除网点管理信息
     *
     * @param locationId 网点管理主键
     * @return 结果
     */
    @Override
    public int deleteGyLocationByLocationId(String locationId) {
        return gyLocationMapper.deleteGyLocationByLocationId(locationId);
    }


}
